From 682d4e94c802fd3336d0de03df4367608d090ae1 Mon Sep 17 00:00:00 2001 From: Yehuda Katz Date: Thu, 8 May 2014 13:33:04 -0700 Subject: [PATCH] Get compile test passing --- src/cargo/ops/cargo_compile.rs | 4 +++- tests/test_cargo_compile.rs | 11 +++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/cargo/ops/cargo_compile.rs b/src/cargo/ops/cargo_compile.rs index a003e3075..5c6a7b521 100644 --- a/src/cargo/ops/cargo_compile.rs +++ b/src/cargo/ops/cargo_compile.rs @@ -33,11 +33,13 @@ pub fn compile(manifest_path: &str) -> CLIResult<()> { let config_paths = configs.find(&("paths".to_owned())).map(|v| v.clone()).unwrap_or_else(|| ConfigValue::new()); - let paths = match config_paths.get_value() { + let mut paths: Vec = match config_paths.get_value() { &config::String(_) => return Err(CLIError::new("The path was configured as a String instead of a List", None, 1)), &config::List(ref list) => list.iter().map(|path| Path::new(path.as_slice())).collect() }; + paths.push(Path::new(manifest_path).dir_path()); + let source = PathSource::new(paths); let summaries = try!(source.list().to_result(|err| CLIError::new(format!("Unable to list packages from {}", source), Some(err.to_str()), 1))); diff --git a/tests/test_cargo_compile.rs b/tests/test_cargo_compile.rs index ba250808f..8a6596695 100644 --- a/tests/test_cargo_compile.rs +++ b/tests/test_cargo_compile.rs @@ -6,7 +6,7 @@ fn setup() { } // Currently doesn't pass due to the code being broken -test!(cargo_compile_with_explicit_manifest_path { +test!(cargo_compile { let p = project("foo") .file("Cargo.toml", r#" [project] @@ -22,15 +22,14 @@ test!(cargo_compile_with_explicit_manifest_path { .file("src/foo.rs", r#" fn main() { println!("i am foo"); - }"#) + } + "#) .build(); - println!("~~~~~~~"); - p.cargo_process("cargo") - .args(["compile".to_owned(), "--manifest-path".to_owned(), "Cargo.toml".to_owned()]) + p.cargo_process("cargo-compile") + .args([]) .exec() .unwrap(); - println!("~~~~~~~"); assert_that(&p.root().join("target/foo"), existing_file()); -- 2.30.2